package chuangyi.com.org.ViewModel;

import android.app.Activity;
import android.content.Context;
import android.databinding.Bindable;
import android.support.annotation.LayoutRes;
import android.view.View;
import android.widget.RadioButton;

import chuangyi.com.org.DOMIHome.BR;
import chuangyi.com.org.DOMIHome.Fragments.CommonFragment;
import chuangyi.com.org.DOMIHome.HomeActivity;
import chuangyi.com.org.DOMIHome.NotifyParentCheckedChanged;
import chuangyi.com.org.DOMIHome.R;

/**
 * Created by zxh on 16/12/16.
 */

public class ClickMenuItem extends MenuItem {

    public ClickMenuItem(Context context, @LayoutRes int layoutId){
        super(context, layoutId);
    }

    public ClickMenuItem(Context context, @LayoutRes int layoutId, String title, String code){
        super(context, layoutId);
        super.setTitle(title);
        super.setCode(code);
    }

    public void onClickItem(View view){
        VideoListModel model = new VideoListModel(getContext());
        model.setLoadType(VideoListModel.LOAD_VIDEO_FROM_MENU);
        model.setMenuItem(this);

        CommonFragment fragment = new CommonFragment();
        fragment.setVariableId(BR.videos);
        fragment.setDataModel(model);
        fragment.setLayoutId(R.layout.f_freevideos);
        HomeActivity.switchFragment((Activity)getContext(), fragment);
    }
}
